package com.mingtu.jgspatrol.activity;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;

import com.blankj.utilcode.util.SizeUtils;
import com.mingtu.common.base.BaseBindingActivity;
import com.mingtu.common.utils.GridSpacingItemDecoration;
import com.mingtu.common.utils.IntentUtils;
import com.mingtu.common.utils.StatusBarUtil;
import com.mingtu.jgspatrol.R;
import com.mingtu.jgspatrol.adapter.ParkModuleAdapter;
import com.mingtu.jgspatrol.databinding.ActivityParkModuleBinding;

public class ParkModuleActivity extends BaseBindingActivity<ActivityParkModuleBinding> {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_park_module;
    }

    @Override
    protected void initView() {
        hideHeadView();
        StatusBarUtil.addStatusBarHeight(binding.statusBarView);

        GridLayoutManager layoutManager1 = new GridLayoutManager(context, 2);//第二个参数为网格的列数
        binding.recycler.addItemDecoration(new GridSpacingItemDecoration(2, SizeUtils.dp2px(15), true, 0));
        binding.recycler.setLayoutManager(layoutManager1);

        ParkModuleAdapter parkModuleAdapter = new ParkModuleAdapter(context);
        binding.recycler.setAdapter(parkModuleAdapter);
        parkModuleAdapter.setOnItemClickListener(new ParkModuleAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull View view, int position) {
                switch (position) {
                    case 0:
                        IntentUtils.getInstance().readyGo(ParkModuleActivity.this, ParkAuditActivity.class); //预约审核
                        break;

                    case 1:
                        IntentUtils.getInstance().readyGo(ParkModuleActivity.this, ParkWhiteListActivity.class); //白名单管理
                        break;

                    case 2:
                        IntentUtils.getInstance().readyGo(ParkModuleActivity.this, ParkManageActivity.class); //车辆管理
                        break;
                }
            }
        });
        binding.ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void getData() {

    }
}